﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace EmailManager.Controllers
{
    [Route("api/[action]")]
    [ApiController]
    public class VerifyEmailController : ControllerBase
    {
        [HttpGet]
        public bool SendVerifyCode(string email)
        {
            try
            {
                VerifyCodeManger.Register(email);
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }

        [HttpGet]
        public bool VerifyEmail(string email, int code)
        {
            return VerifyCodeManger.Verify(email, code);
        }
    }
}